package canBeEqual;

public class Solution {
    public boolean canBeEqual(String s1, String s2) {
        // 判断能不能相等
        // 01 和 13 交换
        char[] chars1 = s1.toCharArray();
        char[] chars2 = s2.toCharArray();
        sort(chars1);
        sort(chars2);
        return new String(chars1).equals(new String(chars2));
    }
    private void sort(char[] chars) {
        if(chars[0]>chars[2]) {
            char c = chars[0];
            chars[0] = chars[2];
            chars[2] = c;
        }
        if(chars[1] > chars[3]) {
            char c = chars[1];
            chars[1] = chars[3];
            chars[3] = c;
        }
    }
}
